package classes;

import java.util.Comparator;

public class User {
	private String _username;
	private String _password;
	private String _gender;
	private String _email;
	private String _nom;
	private String _prenom;
	private Billet _billet;
	
	public User(String Username, String Password, String Gender, String Email, String Prenom, String Nom){
		_username = Username;
		_password = Password;
		_gender = Gender;
		_email = Email;
		_nom = Nom;
		_prenom = Prenom;
		_billet = null;
	}
	
	public User(String Username, String Password){
		_username = Username;
		_password = Password;
		_gender = "";
		_email = "";
		_nom = "";
		_prenom = "";
		_billet = null;
	}
	
	
	public void setUsername(String Username){
		_username = Username;
	}
	
	public void setPassword(String Password){
		_password = Password;
	}
	
	public void setGender(String Gender){
		_gender = Gender;
	}
	
	public void setEmail(String Email){
		_email = Email;
	}
	
	public void setNom(String Nom){
		_nom = Nom;
	}
	
	public void setPrenom(String Prenom){
		_prenom = Prenom;
	}
	
	public String getUsername(){
		return _username;
	}
	
	public String getPassword(){
		return _password;
	}
	
	public String getName(){
		return _prenom + " " + _nom.substring(0,1) + ".";
	}
	
	public Billet getBillet(){
		return _billet;
	}
	
	public void setBillet(Billet billet){
		_billet = billet;
	}
	
	public static Comparator<User> COMPARE_BY_NAME = new Comparator<User>() {
        public int compare(User one, User other) {
            return one.getName().compareTo(other.getName());
        }
    }; 
    
    public static Comparator<User> COMPARE_BY_USERNAME = new Comparator<User>() {
        public int compare(User one, User other) {
            return one.getUsername().compareTo(other.getUsername());
        }
    }; 
}
